//
//  CSEndecrypt.m
//  chinasooen
//
//  Created by  on 12-2-4.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "CSEndecrypt.h"
#import <CommonCrypto/CommonDigest.h>
 

@implementation NSString (encrypt)
 
-(NSString *) encodeMd5
{
    const char *original_str = [self UTF8String];
    unsigned char result[CC_MD5_DIGEST_LENGTH];
    CC_MD5(original_str, strlen(original_str), result);
    NSMutableString *hash = [NSMutableString string];
    for (int i = 0; i < 16; i++)
        [hash appendFormat:@"%02X", result[i]];
    return [hash lowercaseString];
}
 
@end